#ifndef __APP_MODBUS_PROTO_H__
#define __APP_MODBUS_PROTO_H__

#include "system.h"

#if defined(CONFIG_DTU_485)
#    pragma pack(1)
// typedef struct
// {
//     uint8_t  attrId;        //属性ID号
//     uint8_t  slaveAddr;     //从机地址1字节
//     uint8_t  cmd;           //功能码1字节
//     uint16_t regaddr;       //寄存器地址2字节
//     uint16_t regnum;        //寄存器数量2字节
//     uint8_t	 resultOffset;	//取返回值的偏移量；
//     uint8_t  resultType;    //返回值的类型
// }AppModbusProto_t;

#    pragma pack()


uint16_t App_Crc16(uint8_t *buffer, uint16_t buffer_length);
uint8_t CheckSum(uint8_t data[], int len);
int Fill_Data_1B(uint8_t out[], int* index, uint8_t data);
int Fill_Data_4B(uint8_t out[], int *index, uint32_t data);
int Fill_Data(uint8_t out[], int *index, uint8_t data[], int len);
#endif

#endif
